package com.jsoft.jsofted.platform.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.diboot.core.binding.annotation.BindDict;
import com.gitee.sunchenbin.mybatis.actable.annotation.Column;
import com.gitee.sunchenbin.mybatis.actable.annotation.IsNotNull;
import com.gitee.sunchenbin.mybatis.actable.annotation.Table;
import com.gitee.sunchenbin.mybatis.actable.annotation.Unique;
import com.jsoft.jsofted.framework.entity.IdEntity;
import com.jsoft.jsofted.framework.entity.TimeEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.Id;
import java.sql.Timestamp;

/**
 * 租户信息表
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Table("sys_tenant")
@TableName("sys_tenant")
public class TenantEntity implements IdEntity, TimeEntity {

    @Id
    @Column
    @TableId(type = IdType.ASSIGN_ID)
    protected Long id;

    @Column(length = 64)
    @IsNotNull
    protected String name;

    @Column(length = 255)
    protected String address;

    @Column(length = 64)
    @IsNotNull
    protected String contactUser;

    @Column(length = 32)
    @IsNotNull
    @Unique
    protected String contactTel;

    @Column
    @IsNotNull
    protected Timestamp createTime;

    @Column
    @IsNotNull
    protected Timestamp updateTime = new Timestamp(System.currentTimeMillis());

    // 1-启用，0-停用
    @Column(length = 8)
    protected String statusCode;

    @TableField(exist = false)
    @BindDict(type = "TENANT_STATUS", field = "statusCode")
    protected String statusText;

    @Column(length = 32)
    protected String systemName;

    @Column(length = 32)
    @IsNotNull
    @Unique
    protected String username;

    @Column(length = 32)
    @IsNotNull
    protected String password;

}
